<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>属性侦听器</title>
    <script src="https://unpkg.com/vue@next"></script>
  </head>
  <body>
    <div id="Application">
      <input v-model="searchText" />
    </div>
  </body>

  <script>
    const App= {
      data(){
        return {
          searchText:""
        }
      },
      watch: {
        searchText(oldValue, newValue){
            if(newValue.length > 10){
                alert("文本太长了")
            }
        }
      }
    }
    Vue.createApp(App).mount("#Application")
  </script>

</html>